<?php
include '_init_.php';
	$orderManager = Order_Manager::getOrderManager($_REQUEST['id']);
if($orderManager == null)
	exit("Not exist");
if($orderManager->getStatus() != Order_Manager::$STATUS_SAVED)
	exit("Not allowed");
$orderManager->init();


$act = isset($_REQUEST['act'])?$_REQUEST['act']:'';
if($act == 'save')
{
	$orderManager->setCustomerInfo($_REQUEST);
	$orderManager->persistOrderInfo();
	AppMain::refreshParentFrame();
}

$orderInfo = $orderManager->getInfo();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form action="cosib.php">
<input type="hidden" name="act" value="save"/>
<input type="hidden" name="id" value="<?php echo $orderManager->getId();?>"/>
<div class="mainf-8">
  <ul>
   <li class="maina-1k">客戶資料管理</li>
      <li class="mainf-1m"><img src="images/line5.gif" width="676" height="7" align="top" /></li>
<li class="mainf-1k">
       姓名<img src="images/line3.gif" width="21" height="12" /><input name="name" type="text" class="maine-keyina" value="<?php echo Util::html_safe($orderInfo['customerinfo']['name']);?>"/></li>
      <li class="mainf-1k">
        <p>生日<img width="21" height="12" src="images/line3.gif"></p><p>民國</p>
          <input type="text" class="maine-keyinb3" name="birthday_year" value="<?php echo $orderInfo['customerinfo']['birthday']['year'];?>">
      <p>年</p> <label for="select2"></label>
       <select id="select2" class="maine-keyinm4" name="birthday_month">
       <?php
        	for($i = 1; $i < 13; $i++)
        	{
        		if($orderInfo['customerinfo']['birthday']['month'] == $i)
        		{
        			printf("<option value='%d' selected>%02d</option>",$i,$i);
        		}else{
        			printf("<option value='%d'>%02d</option>",$i,$i);
        		}
        	}
        ?>
       </select>
      <p>月</p> 
       <select id="select2" class="maine-keyinm4" name="birthday_date">
       <?php
        	for($i = 1; $i < 32; $i++)
        	{
        		if($orderInfo['customerinfo']['birthday']['date'] == $i)
        		{
        			printf("<option value='%d' selected>%02d</option>",$i,$i);
        		}else{
        			printf("<option value='%d'>%02d</option>",$i,$i);
        		}
        	}
        ?>
       </select>
      <p>日</p></li>
      <li class="mainf-1k">
        電話<img src="images/line3.gif" width="21" height="12" /><input name="tel_part_one" type="text"  class="maine-keyinb" value="<?php echo Util::html_safe($orderInfo['customerinfo']['tel']['part_one']);?>"/><input name="tel_part_two" type="text"  class="maine-keyine" value="<?php echo Util::html_safe($orderInfo['customerinfo']['tel']['part_two']);?>"/>
      </li>
      <li class="mainf-1k">
       手機<img src="images/line3.gif" width="21" height="12" /><input name="mobile" type="text"   class="maine-keyina" value="<?php echo Util::html_safe($orderInfo['customerinfo']['mobile']);?>"/>
      </li>
  </ul>
</div>

<div class="mainf-7">
<ul>
<li class="article-1g"><input name="" type="button" class="article-1a_btn" value="儲存" onclick="document.forms[0].submit();return false;"/></li>
</ul>
</div>
</form>
</body>
</html>
